﻿@page
@inherits Acesoft.Web.UI.RazorPages.WebPage
@{
    Layout = "_shared/edit";
    ViewData["Title"] = "编辑";

    Ace.View().Id("view").Ajax(ds => ds.DataSource("rbac.object").Form(new {
        parentid = App.GetQuery("parentid", ""),
        type = App.GetQuery("type", 0),
        name = "",
        remark = "",
        url = "",
        icon = "",
        opnames = "",
        orderno = 10,
        visible = 1
    }).HttpSave()).Content<dynamic>(
        @<div class="container-fluid">
             <div class="row">
                 @{ var type = (string)App.GetQuery("type", item.type.ToString()); }
                 <div class="col-xs-2 text-r"><span class="cr-red"></span> 父级模块：</div>
                 <div class="col-xs-6">@Ace.ComboTree().Name("parentid").Width("100%").Ajax(a => a.DataSource("rbac.object_tree").RouteValue("type", type).HttpGet())</div>
                 <div class="col-xs-4"></div>
             </div>
            <div class="row">
                <div class="col-xs-2 text-r"><span class="cr-red">*</span> 模块名称：</div>
                <div class="col-xs-6">@Ace.TextBox().Name("name").Width("100%").Required()</div>
                <div class="col-xs-4"></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r"><span class="cr-red">*</span> 模块类别：</div>
                <div class="col-xs-6">@Ace.ComboBox().Name("type").Width("100%").Required().Ajax(ds => ds.Dict("OBJTYPE").HttpGet())</div>
                <div class="col-xs-4"></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r"><span class="cr-red"></span> 模块Url：</div>
                <div class="col-xs-6">@Ace.TextBox().Name("url").Width("100%")</div>
                <div class="col-xs-4">@Ace.LinkButton().Text("选择流程").Click("onSelect()").Width(100).Css("c1")</div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r"><span class="cr-red"></span> 模块图标：</div>
                <div class="col-xs-6">@Ace.TextBox().Name("icon").Width("100%")</div>
                <div class="col-xs-4"></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r">模块设置：</div>
                <div class="col-xs-6">
                    @Ace.CheckBox().Name("visible").Text("可见　")
                </div>
                <div class="col-xs-4"><div class="text-warning">系统属性不能删除！</div></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r"><span class="cr-red">*</span> 排序号：</div>
                <div class="col-xs-6">@Ace.NumberSpinner().Name("orderno").Increment(10).Width("100%").Required()</div>
                <div class="col-xs-4"><div class="text-warning">设置时建议按10，20递增！</div></div>
            </div>
            <div class="row">
                <div class="col-xs-2 text-r">备注：</div>
                <div class="col-xs-6">@Ace.TextBox().Name("remark").Width("100%")</div>
                <div class="col-xs-4"></div>
            </div>
            @Html.AntiForgeryToken()
        </div>
    ).Render();
}
<script>
    function onSelect() {
        var url = $('#url').textbox('getValue');
        var taskId = AX.query('taskid', url) || '';
        AX.dialog('选择流程', '/plat/wf/select?val=' + taskId, function (id) {
            $('#url').textbox('setValue', AX.aurl(url, 'taskid', id));
        }, 500, 500)
    }
</script>